var ScreenSize = {'width': 640, 'height': 1138};
var BaseURL = "./images/";
var debug = new PageDebug("right", "20%", "20", "#F00");
debug.close();
// 第一个页面的资源
var pre_resource = {
    "img": [
        {'name': 'loader', 'src': 'loader.jpg'},
        {'name': 'loading', 'src': 'loading.png'},
    ]
}
// 后面页面的资源
var page_resource = {
    "img": [
        {'name': 'scene', 'src': 'scene.jpg'},
        {'name': 'obj_0_0', 'src': 'obj_0_0.png'},
        {'name': 'obj_1_0', 'src': 'obj_1_0.png'},
        {'name': 'obj_2_0', 'src': 'obj_2_0.png'},
        {'name': 'obj_3_0', 'src': 'obj_3_0.png'},
        {'name': 'obj_4_0', 'src': 'obj_4_0.png'},
        {'name': 'obj_5_0', 'src': 'obj_5_0.png'},
        {'name': 'obj_6_0', 'src': 'obj_6_0.png'},
        {'name': 'obj_7_0', 'src': 'obj_7_0.png'},
        {'name': 'obj_8_0', 'src': 'obj_8_0.png'},
        {'name': 'obj_9_0', 'src': 'obj_9_0.png'},
        {'name': 'obj_10_0', 'src': 'obj_10_0.png'},
        {'name': 'obj_11_0', 'src': 'obj_11_0.png'},
        {'name': 'obj_12_0', 'src': 'obj_12_0.png'},
        {'name': 'obj_13_0', 'src': 'obj_13_0.png'},
        {'name': 'obj_14_0', 'src': 'obj_14_0.png'},
        {'name': 'obj_15_0', 'src': 'obj_15_0.png'},
        {'name': 'obj_16_0', 'src': 'obj_16_0.png'},
        {'name': 'obj_17_0', 'src': 'obj_17_0.png'},
        {'name': 'obj_18_0', 'src': 'obj_18_0.png'},
        {'name': 'obj_19_0', 'src': 'obj_19_0.png'},
        {'name': 'obj_20_0', 'src': 'obj_20_0.png'},
        {'name': 'obj_21_0', 'src': 'obj_21_0.png'},
        {'name': 'obj_22_0', 'src': 'obj_22_0.png'},
        {'name': 'obj_23_0', 'src': 'obj_23_0.png'},
        {'name': 'obj_24_0', 'src': 'obj_24_0.png'},
        {'name': 'obj_25_0', 'src': 'obj_25_0.png'},
        {'name': 'obj_26_0', 'src': 'obj_26_0.png'},
        {'name': 'obj_27_0', 'src': 'obj_27_0.png'},
        {'name': 'obj_28_0', 'src': 'obj_28_0.png'},
        {'name': 'obj_29_0', 'src': 'obj_29_0.png'},
        {'name': 'obj_30_0', 'src': 'obj_30_0.png'},
        {'name': 'obj_31_0', 'src': 'obj_31_0.png'},
        {'name': 'obj_32_0', 'src': 'obj_32_0.png'},
        {'name': 'obj_33_0', 'src': 'obj_33_0.png'},
        {'name': 'obj_34_0', 'src': 'obj_34_0.png'},
        {'name': 'obj_35_0', 'src': 'obj_35_0.png'},
        {'name': 'obj_36_0', 'src': 'obj_36_0.png'},
        {'name': 'obj_37_0', 'src': 'obj_37_0.png'},
        {'name': 'obj_38_0', 'src': 'obj_38_0.png'},
        {'name': 'obj_39_0', 'src': 'obj_39_0.png'},
        {'name': 'obj_40_0', 'src': 'obj_40_0.png'},
        {'name': 'obj_41_0', 'src': 'obj_41_0.png'},
        {'name': 'obj_42_0', 'src': 'obj_42_0.png'},
        {'name': 'obj_43_0', 'src': 'obj_43_0.png'},
        {'name': 'obj_44_0', 'src': 'obj_44_0.png'},
        {'name': 'obj_45_0', 'src': 'obj_45_0.png'},
        {'name': 'obj_46_0', 'src': 'obj_46_0.png'},
        {'name': 'obj_47_0', 'src': 'obj_47_0.png'},
        {'name': 'obj_48_0', 'src': 'obj_48_0.png'},
        {'name': 'obj_49_0', 'src': 'obj_49_0.png'},
        {'name': 'obj_50_0', 'src': 'obj_50_0.png'},
    ],
    "group": [
        {'prefix': 'obj_3_', 'postfix': '.png', 'start': 0, 'end': 1},
        {'prefix': 'obj_6_', 'postfix': '.png', 'start': 0, 'end': 4},
        {'prefix': 'obj_8_', 'postfix': '.png', 'start': 0, 'end': 3},
        {'prefix': 'obj_11_', 'postfix': '.png', 'start': 0, 'end': 3},
        {'prefix': 'obj_13_', 'postfix': '.png', 'start': 0, 'end': 5},
        {'prefix': 'obj_14_', 'postfix': '.png', 'start': 0, 'end': 3},
        {'prefix': 'obj_15_', 'postfix': '.png', 'start': 0, 'end': 1},
        {'prefix': 'obj_16_', 'postfix': '.png', 'start': 0, 'end': 1},
        {'prefix': 'obj_19_', 'postfix': '.png', 'start': 0, 'end': 1},
        {'prefix': 'obj_28_', 'postfix': '.png', 'start': 0, 'end': 1},
        {'prefix': 'obj_30_', 'postfix': '.png', 'start': 0, 'end': 5},
        {'prefix': 'obj_33_', 'postfix': '.png', 'start': 0, 'end': 2},
        {'prefix': 'obj_45_', 'postfix': '.png', 'start': 0, 'end': 2},
        {'prefix': 'obj_48_', 'postfix': '.png', 'start': 0, 'end': 6},
    ]
}
// 页面锁住
var PageLock = true;
var ScreenSize = {Width: 640, Height: 1040};
// 页面是否可以滚动
function page_scroll(e) {
    if (PageLock) {
        e.preventDefault();
    }
}
var Page_Loader;
// 首屏
$(document).ready(function () {
    document.body.addEventListener('touchmove', function (e) {
        page_scroll(e);
    }, false);
    ScreenSize.Width = window.innerWidth;
    ScreenSize.Height = window.innerHeight;
    // 初始化
    PageSound.play(0);
    Page_Loader = new PageLoader(BaseURL);
    //Page_Loader.noCache();
    // 加载第一屏
    Page_Loader.load(pre_resource, null, function () {
        $("#loader").show();
        // 加载第二屏
        Page_Loader.load(page_resource, function (process) {
            $("#process").html(process + "%");
        }, function () {
            //动画初始化
            Movie.init();
            // 首屏清除
            $("#loader").fadeOut(1000);
        });
    });
    // $("#btn_open").click(function () {
    //     FinalOpen = true;
    //     PageSound.play(14);
    //     Movie.SceneHeight = 16800;
    // });
    // $("#share").click(function () {
    //     setTimeout(function () {
    //         $("#share").fadeOut(500);
    //     }, 500)
    // });
});
// 音乐播放
var PageSound = {
    music: null,
    _init: false,
    interval: 1,
    init: function () {
        debug.write("PageSound.init");
        if (PageSound._init) {
            return;
        }
        PageSound._init = true;
        PageSound.music = new Array();
        // 为什么要同时播放两个??
        PageSound.music[0] = document.createElement("audio");
        PageSound.music[1] = document.createElement("audio");
        PageSound.music[0].src = "./sound/sound_0.mp3";
        PageSound.music[1].src = "./sound/sound_0.mp3";
        wx.ready(function () {
            PageSound.music[0].play();
            PageSound.music[1].play();
        });
    },

    play: function (id) {
        PageSound.init();
        if (id == 0)return;
        PageSound.interval = (PageSound.interval + 1) % 2;
        PageSound.music[PageSound.interval].pause();
        PageSound.music[PageSound.interval].src = "http://cdn1.wanleyun.cn/zhongan/sound/sound_" + id + ".mp3?222";
        wx.ready(function () {
            debug.write("ps.play:" + id);
            PageSound.music[PageSound.interval].play();
        });
    }
};
var Movie = {
    MovieInterval: null,
    MovieFrame: 0,
    MovieCanvas: null,
    MovieContext: null,
    ObjCanvas: null,
    ObjContext: null,
    Width: 640,
    Height: 1138,
    Pos: 0,
    Speed: 0,
    // 场景高度
    SceneHeight: 15550,
    init: function () {
        $("#movie").show();
        Movie.Height = ScreenSize.Height;
        Movie.MovieCanvas = document.getElementById("MovieCanvas");
        Movie.MovieContext = Movie.MovieCanvas.getContext('2d');
        $(Movie.MovieCanvas).attr('height', ScreenSize.Height);
        // 添加一个新的canvas
        Movie.ObjCanvas = document.createElement("canvas");
        $(Movie.ObjCanvas).attr('width', Movie.Width).attr("height", Movie.Height);
        Movie.ObjContext = Movie.ObjCanvas.getContext("2d");
        Movie.play();
        document.getElementById("movie").addEventListener("touchstart", touch_start, false);
        document.getElementById("movie").addEventListener("touchmove", touch_move, false);
        document.getElementById("movie").addEventListener("touchend", touch_end, false);
    },
    play: function () {
        Movie.MovieFrame = 0;
        Movie.MovieInterval = setInterval(function () {
            Movie.MovieContext.clearRect(0, 0, Movie.Width, Movie.Height);
            Movie.MovieContext.drawImage(PageResource['scene'], 0, Movie.Pos, Movie.Width, Movie.Height, 0, 0, Movie.Width, Movie.Height);
            Movie.ObjContext.clearRect(0, 0, Movie.Width, Movie.Height);
            for (i = 0; i < Objs.length; i++) {
                // 判断应不应该展示
                if (Objs[i].show()) {
                    pos = Objs[i].pos();
                    pos[1] = pos[1] - Movie.Pos;
                    Movie.ObjContext.drawImage(PageResource[Objs[i].img + Objs[i].frame()], pos[0], pos[1]);
                }
            }
            // 在这里画了一个空的canvas图片 和当前canvas一样大 ?? 
            Movie.MovieContext.drawImage(Movie.ObjCanvas, 0, 0);
            Movie.MovieFrame++;
            if (Movie.MovieFrame == 24) {
                Movie.MovieFrame = 0;
            }
            if (!touchStart) {
                Movie.Speed = Movie.Speed * 0.8;
            } else {
                //位移距离
                Movie.Speed = oldY - newY;
            }
            Movie.Pos = Movie.Pos + Movie.Speed;
            Movie.Pos = Math.max(Movie.Pos, 0);
            Movie.Pos = Math.min(Movie.Pos, Movie.SceneHeight - Movie.Height);
            if (Movie.Speed > 0) {
                for (i = 1; i < SoundPoint.length; i++) {
                    if (Math.abs(Movie.Pos - SoundPoint[i]) < 100 && Movie.Pos > SoundPoint[i]) {
                        if (SoundPlay == i)return;
                        SoundPlay = i;
                        PageSound.play(i);
                        break;
                    }
                }
            }
            oldY = newY;
        }, 50);
    }
}
var SoundPoint = [0, 150, 450, 1000, 1800, 2300, 3800, 5400, 6450, 8100, 8500, 9300, 11000, 12700];
var SoundPlay = 0;
var newY, oldY;
newY = 0;
oldY = 0;
var touchStart = false;
function touch_start(e) {
    if (touchStart) return;
    if (e.touches.length == 1) {
        touchStart = true;
        oldY = e.touches[0].pageY;
        newY = oldY;
    }
}
function touch_move(e) {
    if (!touchStart)return;
    newY = e.touches[0].pageY;
}
function touch_end(e) {
    if (!touchStart)return;
    touchStart = false;
}
// 不同的动画对象
var Objs = [
    {
        img: 'obj_0_',
        show: function () {
            if (Movie.Pos < 700) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 155 - 100 * Movie.Pos / 100;
            x = Math.max(x, 55);
            y = 400 + 40 * Movie.Pos / 100;
            y = Math.min(440, y);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    }, {
        img: 'obj_1_',
        show: function () {
            if (Movie.Pos < 700) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [102, 402];
        },
        frame: function () {
            return 0;
        }
    }, {
        img: 'obj_2_',
        show: function () {
            if (Movie.Pos < 700 && Movie.Pos > 100) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {

            return [30, 320];
        },
        frame: function () {
            return 0;
        }
    }, {
        img: 'obj_3_',
        show: function () {
            if (Movie.Pos < 1100) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 640 - 500 * Movie.Pos / 300;
            x = Math.max(x, 140);
            y = 700 + 20 * Movie.Pos / 300;
            y = Math.min(720, y);
            return [x, y];
        },
        f: 0,
        frame: function () {
            if (Movie.Speed > 0 && this.f == 1) {
                this.f = 0;
            }
            if (Movie.Speed < 0 && this.f == 0) {
                this.f = 1;
            }
            return this.f;
        }
    }, {
        img: 'obj_4_',
        show: function () {
            if (Movie.Pos < 800 && Movie.Pos > 100) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 750 - 500 * Movie.Pos / 300;
            x = Math.max(x, 250);
            y = 580 + 20 * Movie.Pos / 300;
            y = Math.min(600, y);

            return [x, y];
        },
        frame: function () {
            return 0;
        }
    }, {
        img: 'obj_5_',
        show: function () {
            if (Movie.Pos < 1500 && Movie.Pos > 400) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 100 + 140 * (Movie.Pos - 400) / 100;
            x = Math.min(x, 240);
            y = 1200;
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    }, {
        img: 'obj_6_',
        show: function () {
            if (Movie.Pos < 1500 && Movie.Pos > 500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [270, 1080];
        },
        frame: function () {
            return Math.min(4, Math.floor((Movie.Pos - 500) / 100));
        }
    }, {
        img: 'obj_7_',
        show: function () {
            if (Movie.Pos < 1500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [0, 1200];
        },
        frame: function () {
            return 0;
        }
    }, {
        img: 'obj_8_',
        show: function () {
            if (Movie.Pos < 1600) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 150 - 150 * (Movie.Pos - 450) / 500;
            x = Math.min(Math.max(x, 0), 150);
            y = 1150 + 100 * (Movie.Pos - 450) / 500;
            y = Math.min(Math.max(y, 1150), 1250);
            return [x, y];
        },
        frame: function () {
            if (Movie.Pos < 450 || Movie.Pos > 1050)return 0;
            return Math.floor((Movie.Pos - 400) / 50) % 4
            return 0;
        }
    }, {
        img: 'obj_9_',
        show: function () {
            if (Movie.Pos < 1600 && Movie.Pos > 600) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 170 - 150 * (Movie.Pos - 450) / 500;
            x = Math.min(Math.max(x, 20), 150);
            y = 1000 + 100 * (Movie.Pos - 450) / 500;
            y = Math.min(Math.max(y, 1000), 1100);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_10_',
        show: function () {
            if (Movie.Pos < 1800 && Movie.Pos > 1000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [100, 1580];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_11_',
        show: function () {
            if (Movie.Pos < 1900 && Movie.Pos > 1000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [160, 1650];
        },
        frame: function () {
            return Math.floor(Movie.MovieFrame / 6);
        }
    },
    {
        img: 'obj_12_',
        show: function () {
            if (Movie.Pos < 1900 && Movie.Pos > 1050) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [420, 1680];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_13_',
        show: function () {
            if (Movie.Pos < 1900 && Movie.Pos > 1050) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [320, 1750];
        },
        frame: function () {
            return Math.floor(Movie.MovieFrame / 6);
        }
    },
    {
        img: 'obj_14_',
        show: function () {
            if (Movie.Pos < 2400 && Movie.Pos > 1000) {
                return true;
            } else {
                return false;
            }
        },
        x: Math.random(),
        y: Math.random(),
        pos: function () {
            this.x = this.x + Math.PI / 20 * Math.random();
            this.y = this.y + Math.PI / 20 * Math.random();
            x = 300 + 30 * Math.sin(this.x);
            y = 2000 + 30 * Math.cos(this.y);
            return [x, y];
            return [300, 2050];
        },
        frame: function () {
            return Math.floor(Movie.MovieFrame / 6);
        }
    },
    {
        img: 'obj_15_',
        show: function () {
            if (Movie.Pos < 2500 && Movie.Pos > 1400) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [0, 1962];
        },
        frame: function () {
            return Math.round(Movie.MovieFrame / 24);
        }
    },
    {
        img: 'obj_16_',
        show: function () {
            if (Movie.Pos < 2500 && Movie.Pos > 1000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 230 + 30 * (Movie.Pos - 1800) / 200;
            x = Math.min(Math.max(x, 230), 260);
            y = 2380 + 20 * (Movie.Pos - 1800) / 200;
            y = Math.min(Math.max(y, 2380), 2400);
            return [x, y];
            return [270, 2400];
            return [230, 2380];
        },
        f: 0,
        frame: function () {
            if (Movie.Speed > 0 && this.f == 1) {
                this.f = 0;
            }
            if (Movie.Speed < 0 && this.f == 0) {
                this.f = 1;
            }
            return this.f;
        }
    },
    {
        img: 'obj_17_',
        show: function () {
            if (Movie.Pos < 2500 && Movie.Pos > 1700) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [140, 2240];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_18_',
        show: function () {
            if (Movie.Pos < 3500 && Movie.Pos > 2200) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [350, 2740];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_19_',
        show: function () {
            if (Movie.Pos < 3500 && Movie.Pos > 1500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [320, 2900];
        },
        frame: function () {
            if (Movie.Pos > 2300) {
                return 1;
            }
            return 0;
        }
    },
    {
        img: 'obj_20_',
        show: function () {
            if (Movie.Pos < 3500 && Movie.Pos > 2200) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 640 - 360 * (Movie.Pos - 2200) / 300;
            x = Math.min(Math.max(x, 280), 640);
            y = 2800 + 250 * (Movie.Pos - 2200) / 300;
            y = Math.min(Math.max(y, 2800), 3050);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_21_',
        show: function () {
            if (Movie.Pos < 5000 && Movie.Pos > 3000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 290 - 100 * (Movie.Pos - 3700) / 200;
            x = Math.min(Math.max(x, 190), 290);
            y = 4280 + 100 * (Movie.Pos - 3700) / 200;
            y = Math.min(Math.max(y, 4280), 4380);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_22_',
        show: function () {
            if (Movie.Pos < 5000 && Movie.Pos > 3000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [291, 4192];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_23_',
        show: function () {
            if (Movie.Pos < 5000 && Movie.Pos > 3700) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [380, 4440];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_24_',
        show: function () {
            if (Movie.Pos < 5000 && Movie.Pos > 3000) {
                if (Movie.MovieFrame < 12) {
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        },
        pos: function () {
            return [10, 4580];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_25_',
        show: function () {
            if (Movie.Pos < 6000 && Movie.Pos > 5000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [270, 5730];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_26_',
        show: function () {
            if (Movie.Pos < 6700 && Movie.Pos > 5500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [300, 6020];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_27_',
        show: function () {
            if (Movie.Pos < 6700 && Movie.Pos > 5500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 100 * (Movie.Pos - 5700) / 200;
            x = Math.min(Math.max(x, 0), 100);
            y = 6270 - 100 * (Movie.Pos - 5700) / 200;
            y = Math.min(Math.max(y, 6170), 6270);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_28_',
        show: function () {
            if (Movie.Pos < 6700 && Movie.Pos > 5000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 40 + 100 * (Movie.Pos - 5700) / 200;
            x = Math.min(Math.max(x, 40), 140);
            y = 6400 - 100 * (Movie.Pos - 5700) / 200;
            y = Math.min(Math.max(y, 6300), 6400);
            return [x, y];
            return [140, 6300];
            return [40, 6400];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_29_',
        show: function () {
            if (Movie.Pos < 7500 && Movie.Pos > 6400) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [130, 7050];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_30_',
        show: function () {
            if (Movie.Pos < 7500 && Movie.Pos > 5500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [150, 7150];
        },
        frame: function () {
            return Math.floor(Movie.MovieFrame / 4);
        }
    },
    {
        img: 'obj_31_',
        show: function () {
            if (Movie.Pos < 8000 && Movie.Pos > 5500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 750 - 200 * (Movie.Pos - 6500) / 300;
            x = Math.min(Math.max(x, 550), 750);
            y = 7500 - 70 * (Movie.Pos - 6500) / 300;
            y = Math.min(Math.max(y, 7430), 7500);
            return [x, y];
            return [550, 7430];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_32_',
        show: function () {
            if (Movie.Pos < 9000 && Movie.Pos > 7000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 720 - 240 * (Movie.Pos - 7800) / 300;
            x = Math.min(Math.max(x, 480), 720);
            y = 8500;
            return [x, y];
            return [400, 8500];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_33_',
        show: function () {
            if (Movie.Pos < 9000 && Movie.Pos > 7000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 620 - 240 * (Movie.Pos - 7800) / 300;
            x = Math.min(Math.max(x, 380), 620);
            y = 8610;
            return [x, y];

            return [620, 8610];

            return [380, 8610];
        },
        frame: function () {
            if (Movie.Pos > 8150) {
                return 2;
            }
            if (Movie.Pos > 8100) {
                return 1;
            }
            return 0;
        }
    },
    {
        img: 'obj_34_',
        show: function () {
            if (Movie.Pos < 9700 && Movie.Pos > 8500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 640 - 440 * (Movie.Pos - 8500) / 300;
            x = Math.min(Math.max(x, 200), 640);
            y = 8900 + 300 * (Movie.Pos - 8500) / 300;
            y = Math.min(Math.max(y, 8900), 9200);
            return [x, y];
            return [200, 9100];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_35_',
        show: function () {
            if (Movie.Pos < 10500 && Movie.Pos > 9300) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = -110 + 160 * (Movie.Pos - 9200) / 200;
            x = Math.min(Math.max(x, -110), 50);
            y = 9900 - 160 * (Movie.Pos - 9200) / 200;
            y = Math.min(Math.max(y, 9740), 9900);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_36_',
        show: function () {
            if (Movie.Pos < 10500 && Movie.Pos > 8500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = -140 + 160 * (Movie.Pos - 9200) / 200;
            x = Math.min(Math.max(x, -140), 20);
            y = 10140 - 160 * (Movie.Pos - 9200) / 200;
            y = Math.min(Math.max(y, 9980), 10140);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_37_',
        show: function () {
            if (Movie.Pos < 10500 && Movie.Pos > 9500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [340, 10100];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_38_',
        show: function () {
            if (Movie.Pos < 10500 && Movie.Pos > 8300) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [440, 10280];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_39_',
        show: function () {
            if (Movie.Pos < 12500 && Movie.Pos > 10700) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [300, 11250];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_40_',
        show: function () {
            if (Movie.Pos < 12500 && Movie.Pos > 10000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = 560 - 110 * (Movie.Pos - 10700) / 200;
            x = Math.min(Math.max(x, 450), 560);
            y = 11580 - 100 * (Movie.Pos - 10700) / 200;
            y = Math.min(Math.max(y, 11480), 11580);
            return [x, y];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_41_',
        show: function () {
            if (Movie.Pos < 12500 && Movie.Pos > 10000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [445, 11407];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_42_',
        show: function () {
            if (Movie.Pos < 12500 && Movie.Pos > 10000) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            x = -150 + 200 * (Movie.Pos - 11000) / 200;
            x = Math.min(Math.max(x, -150), 50);
            y = 11900 - 100 * (Movie.Pos - 11000) / 200;
            y = Math.min(Math.max(y, 11800), 11900);
            return [x, y];
            return [-150, 11500];
        },
        frame: function () {

            return 0;
        }
    },
    {
        img: 'obj_43_',
        show: function () {
            if (Movie.Pos < 13200 && Movie.Pos > 12400) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [250, 13000];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_44_',
        show: function () {
            if (Movie.Pos < 13500 && Movie.Pos > 12600) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [10, 13370];
        },
        frame: function () {

            return 0;


        }
    },
    {
        img: 'obj_45_',
        show: function () {
            if (Movie.Pos < 14000 && Movie.Pos > 12000) {
                return true;
            } else {
                return false;
            }

        },
        pos: function () {
            return [30, 13500];
        },
        frame: function () {
            return Math.floor((Movie.MovieFrame % 12) / 4);
        }
    },
    {
        img: 'obj_46_',
        show: function () {
            if (Movie.Pos < 14500 && Movie.Pos > 13500) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [210, 14170];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_47_',
        show: function () {
            if (Movie.Pos < 14500 && Movie.Pos > 13600) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [350, 14120];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_48_',
        show: function () {
            if (Movie.Pos < 15500 && Movie.Pos > 13500 && FinalOpen) {
                return true;
            } else {
                return false;
            }
        },
        pos: function () {
            return [0, 14600];
        },
        f: 0,
        frame: function () {
            if (Movie.MovieFrame % 4 == 0) {
                this.f++;
            }
            this.f = this.f % 7;
            return this.f;
        }
    },
    {
        img: 'obj_49_',
        show: function () {
            if (Movie.Pos < 15500 && Movie.Pos > 13500 && FinalOpen == false) {
                $("#btn_open").show();
                $("#btn_open").css('top', (15230 - Movie.Pos) + "px");
                return true;
            } else {
                $("#btn_open").hide();
                return false;
            }
        },
        pos: function () {
            return [200, 15230];
        },
        frame: function () {
            return 0;
        }
    },
    {
        img: 'obj_50_',
        show: function () {
            if (Movie.Pos < 16500 && Movie.Pos > 14000 && FinalOpen) {
                $("#btn_link").show();
                $("#btn_link").css('top', (16570 - Movie.Pos) + "px");
                $("#btn_share").show();
                $("#btn_share").css('top', (16660 - Movie.Pos) + "px");

                return true;
            } else {
                $("#btn_link").hide();
                $("#btn_share").hide();
                return false;
            }
        },
        pos: function () {
            return [0, 15240];
        },
        frame: function () {
            return 0;
        }
    }
]
var FinalOpen = false;
	